home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cdity
/
ModeProSrc.lha
/
Prefs
/
MPPReqs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-07-29
|
7KB
|
210 lines
#include "MPP.h"
extern struct MPSem *MPSem;
extern STRPTR MiscText[];
extern struct FontRequester *FontReq;
extern struct ScreenModeRequester *ScrReq;
extern struct TextAttr *TAttr;
//void CreateDefaultModeList(struct List *List);
//void FreeDefaultModeList(struct List *List);
BYTE ModeSelectDoDims[]={0,0,1,1,0};
BOOL PickFont(struct Window *Win, struct TTextAttr *TA)
{
ULONG skip=0;
WORD width;
if(TA)
{
if(!FontReq)
{
width=Win->Width/2;
FontReq=(struct FontRequester *)AllocAslRequestTags(ASL_FontRequest,
ASLFO_TextAttr, TAttr,
ASLFO_InitialTopEdge, Win->TopEdge+8,
ASLFO_InitialLeftEdge, Win->LeftEdge+width/2,
ASLFO_InitialWidth, width,
ASLFO_InitialHeight, Win->Height-16,
ASLFO_TitleText, MiscText[SELECT_SCREEN_FONT],
ASLFO_DoStyle, TRUE,
ASLFO_MinHeight, 1,
ASLFO_MaxHeight, 65535,
ASLFO_PrivateIDCMP, TRUE,
TAG_DONE);
}
if(FontReq)
{
if(!TA->tta_Name)
skip=4;
if(AslRequestTags(FontReq,
ASLFO_Window, Win,
ASLFO_SleepWindow, TRUE,
TAG_SKIP, skip,
ASLFO_InitialName, TA->tta_Name,
ASLFO_InitialSize, TA->tta_YSize,
ASLFO_InitialStyle, TA->tta_Style,
ASLFO_InitialFlags, TA->tta_Flags,
TAG_DONE))
{
ObtainSemaphore(&MPSem->NodeSem);
FreeVec(TA->tta_Name);
if(TA->tta_Name=AllocVec(strlen(FontReq->fo_TAttr.tta_Name)+1,MEMF_PUBLIC|MEMF_CLEAR))
strcpy(TA->tta_Name,FontReq->fo_TAttr.tta_Name);
TA->tta_YSize = FontReq->fo_TAttr.tta_YSize;
TA->tta_Style = FontReq->fo_TAttr.tta_Style & (~FSF_TAGGED);
TA->tta_Flags = FontReq->fo_TAttr.tta_Flags;
ReleaseSemaphore(&MPSem->NodeSem);
return(TRUE);
}
}
}
return(FALSE);
}
ULONG SelectScreenMode(struct Window *Win, struct DefaultNode *n, BOOL DoOrig)
{
UBYTE dodims;
UBYTE title[100]={0};
WORD width;
ULONG retval=0;
struct List defmodelist;
STRPTR selectstring="%s";
NewList(&defmodelist);
if(!DoOrig)
{
switch(n->ModeSelect)
{
case MS_PROMOTE_MONITOR:
selectstring=GetString(MSG_REQ_SELECT_MONITOR_FOR);
break;
case MS_PROMOTE_SCREENMODE:
case MS_PROMOTE_REQUESTER:
selectstring=GetString(MSG_REQ_SELECT_SCREENMODE_FOR);
break;
}
sprintf(title,selectstring,n->Def_Node.ln_Name);
}
else
{
strcpy(title,GetString(MSG_SELWIN_SCRMODES));
//CreateDefaultModeList(&defmodelist);
}
if(!ScrReq)
{
width=Win->Width/2;
ScrReq=(struct ScreenModeRequester *)AllocAslRequestTags(ASL_ScreenModeRequest,
ASLSM_TextAttr, TAttr,
ASLSM_InitialTopEdge ,Win->TopEdge+8,
ASLSM_InitialLeftEdge ,Win->LeftEdge+width/2,
ASLSM_InitialWidth ,width,
ASLSM_InitialHeight ,Win->Height-16,
ASLSM_PropertyFlags ,0,
ASLSM_PropertyMask ,DIPF_IS_PF2PRI,//BADMODES,
ASLSM_PrivateIDCMP, TRUE,
TAG_END);
}
if(ScrReq)
{
dodims=ModeSelectDoDims[n->ModeSelect] && (!DoOrig);
if(AslRequestTags(ScrReq,
ASLSM_Window ,Win,
ASLSM_TitleText ,title,
ASLSM_SleepWindow ,TRUE,
ASLSM_DoWidth ,dodims ,
ASLSM_DoHeight ,dodims ,
ASLSM_DoOverscanType ,dodims ,
ASLSM_DoAutoScroll ,dodims ,
TAG_SKIP ,(DoOrig ? 0:2),
ASLSM_DoDepth ,FALSE,
ASLSM_InitialDisplayID ,n->OrigDisplayID,
TAG_SKIP ,(DoOrig ? 7:0),
ASLSM_DoDepth ,(n->Flags & DEPTH) && dodims,
ASLSM_InitialAutoScroll ,n->AutoScroll,
ASLSM_InitialDisplayWidth ,n->Width,
ASLSM_InitialDisplayHeight ,n->Height,
ASLSM_InitialDisplayID ,n->ModeID,
ASLSM_InitialDisplayDepth ,n->Depth,
ASLSM_InitialOverscanType ,n->OverscanType,
// ASLSM_CustomSMList ,defmodelist,
TAG_DONE))
{
ObtainSemaphore(&MPSem->NodeSem);
if(DoOrig)
n->OrigDisplayID=ScrReq->sm_DisplayID;
else
{
n->ModeID =ScrReq->sm_DisplayID;
if(dodims)
{
n->Width =ScrReq->sm_DisplayWidth;
n->Height =ScrReq->sm_DisplayHeight;
n->OverscanType =ScrReq->sm_OverscanType;
n->Depth =ScrReq->sm_DisplayDepth;
}
n->AutoScroll =ScrReq->sm_AutoScroll;
}
retval=TRUE;
ReleaseSemaphore(&MPSem->NodeSem);
}
}
//FreeDefaultModeList(&defmodelist);
return(retval);
}
/*
void CreateDefaultModeList(struct List *List)
{
struct DisplayInfo dinfo;
struct DisplayMode *dmode;
ULONG id,ok;
id=NextDisplayInfo(INVALID_ID);
while(id!=INVALID_ID && !(id&MONITOR_ID_MASK))
{
if(GetDisplayInfoData(0,(UBYTE *)&dinfo,sizeof(dinfo),DTAG_DISP,id))
{
if(!(dinfo.PropertyFlags & SPECIAL_FLAGS))
{
ok=FALSE;
if(dmode=AllocVec(sizeof(struct DisplayMode),MEMF_PUBLIC|MEMF_CLEAR))
{
if(dmode->dm_Node.ln_Name=GetModeName(id))
{
if(GetDisplayInfoData(0,(UBYTE *)&dmode->dm_DimensionInfo,sizeof(dmode->dm_DimensionInfo),DTAG_DIMS,id))
{
dmode->dm_PropertyFlags=dinfo.PropertyFlags;
AddTail(List,(struct Node *)dmode);
ok=TRUE;
}
}
if(!ok)
{
FreeVec(dmode->dm_Node.ln_Name);
FreeVec(dmode);
}
}
}
}
id=NextDisplayInfo(id);
}
}
void FreeDefaultModeList(struct List *List)
{
struct DisplayMode *dmode;
while(dmode=(struct DisplayMode *)RemHead(List))
{
FreeVec(dmode->dm_Node.ln_Name);
FreeVec(dmode);
}
}
*/